<%@ page pageEncoding="UTF-8"%>
<%@ include file="../common/head.jsp"%>
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
<%@ include file="./msg/meta.jsp"%>
</head>
<body>
	<div class="layui-fluid">
		<div class="layui-row">
			<form action="${ctx}/sys/update${actionclass}.do" method="post" class="layui-form" style="margin-top: 10px" id="dataform">
			<input type="hidden" value="${modifybean.id}" name="id" />
				<div class="layui-form-item">
					<label class="layui-form-label">课程</label>
					<div class="layui-input-block">
						<select name="courseId" id="CourseComment_course">
							<c:forEach items="${list}" var="item">
								<option value="${item.id }">${item.name }</option>
							</c:forEach>
						</select>
					</div>
				</div>			

				<div class="layui-form-item">
					<label class="layui-form-label">用户</label>
					<div class="layui-input-block">
						<select name="userId" id="CourseComment_user">
							<c:forEach items="${list}" var="item">
								<option value="${item.id }">${item.name }</option>
							</c:forEach>
						</select>
					</div>
				</div>			

				<div class="layui-form-item">
					<label class="layui-form-label">发表日期</label>
					<div class="layui-input-block">
						<input type="text" name="addDate" id="CourseComment_addDate" lay-verify="" value="${modifybean.addDate}" lay-reqtext="请输入FIELDNOTE" placeholder=""
							autocomplete="off" class="layui-input date" readonly="readonly">
					</div>
				</div>			

				<div class="layui-form-item">
					<label class="layui-form-label">评分</label>
					<div class="layui-input-block">
						<input type="text" name="score" id="CourseComment_score" value="${modifybean.score}" lay-verify="required|number" lay-reqtext="请输入FIELDNOTE"
							placeholder="" autocomplete="off" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">评价</label>
					<div class="layui-input-block">
						<input type="text" name="content" id="CourseComment_content" value="${modifybean.content}" lay-verify="required" lay-reqtext="请输入FIELDNOTE"
							placeholder="" autocomplete="off" class="layui-input">
					</div>
				</div>


				<div class="layui-form-item">
					<div class="layui-input-block">
						<button type="submit" class="layui-btn" lay-submit="" lay-filter="sysgo">保存</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>
<script>
$("#CourseComment_course").val("${modifybean.course.id}");
$("#CourseComment_user").val("${modifybean.user.id}");

	layui.use([ 'laydate', 'form' ], function() {
		var laydate = layui.laydate;
		var form = layui.form;
		form.verify({
		});
		form.on('submit(sysgo)', function(data) {
			console.log(data.form.action);
			$.ajax({
				type : 'POST',
				url : data.form.action,
				dataType : 'json',
				data : data.field,
				success : function(data) {
					if (data.statusCode == 200) {
						layer.msg(data.message, {
							icon : 1,
							time : 1000
						}, function() {
							var index = parent.layer.getFrameIndex(window.name);
							parent.location.replace(parent.location.href)
							parent.layer.close(index);

						});
					} else {
						layer.msg(data.message, {
							icon : 2,
						});
					}
				},
				error : function(data) {
					console.log(data);
				},
			});
			return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
		});
		lay('.date').each(function() {
			laydate.render({
				elem : this,
				type : "date", //year,month,date,time,datetime
				range : false, //范围
				format : "yyyy-MM-dd",
			//value : "",//默认值
			//min/max - 最小/大范围内的日期时间值,正负值
			});
		});
	});
	$(function() {
		layui.use('upload', function() {
			var $ = layui.jquery,
				upload = layui.upload;
			//普通图片上传

		});
	});
</script>
</html>
<%@ include file="../common/clear.jsp"%>
